exports.MMMainMenu = GL2.Node.subclass(
{
    classname: 'MMMainMenu',
    
    initialize: function() 
    {
		this._backgroundImage = null;
		this._closeButton = null;
		this._rateGameButton = null;
		this._chicksRevegeButton = null;
		this._settingsButton = null;
		this._mainMenuText = null;
		this._zoomButtonPath = null;
		this._zoomButton = null;
		this._giftsButton = null;
		this._coinsButton = null;
		this._nuggetsButton = null;
		this._shopButton = null;
		this._decorationButton = null;
		this._liftButton = null;
		this._addFloorButton = null;
		this._menuButtonsArray = null;
    },
	
	createView: function() 
	{
		this.checkZoomState();
		this._menuButtonsArray = new GAMutableArray();
		
		var backgroundImagePath = this.getBaseResourcePath() + "main-menu-background.png";
		
		var closeButtonImageNormal = this.getBaseResourcePath() + "close-button-normal.png";
		var closeButtonImagePressed = this.getBaseResourcePath() + "close-button-pressed.png";
		//getButtonImagePath
		var genericButtonImagePathNormal = this.getBaseResourcePath() + "button-normal.png"
		var genericButtonImagePathPressed = this.getBaseResourcePath() + "button-pressed.png"		
			
//		var rateGameImagePathNormal = this.getBaseResourcePath() + "button-normal.png";
//		var rateGameImagePathPressed = this.getBaseResourcePath() + "button-pressed.png";
//		
//		var chicksRevegeImagePathNormal = this.getBaseResourcePath() + "button-normal.png";
//		var chicksRevegeImagePathPressed = this.getBaseResourcePath() + "button-pressed.png";
//		
//		var settingsImagePathNormal = this.getBaseResourcePath() + "button-normal.png";
//		var settingsImagePathPressed = this.getBaseResourcePath() + "button-pressed.png";
//		
//		var tasksImagePathNormal = this.getBaseResourcePath() + "button-normal.png";
//		var tasksImagePathPressed = this.getBaseResourcePath() + "button-pressed.png";
//		
//		var coinsImagePathNormal = this.getBaseResourcePath() + "button-normal.png";
//		var coinsImagePathPressed = this.getBaseResourcePath() + "button-pressed.png";	
//		
//		var nuggetsImagePathNormal = this.getBaseResourcePath() + "button-normal.png";
//		var nuggetsImagePathPressed = this.getBaseResourcePath() + "button-pressed.png";

		this._backgroundImage = GLFactory.getSprite([TCUtil.getAdjustedX(0),TCUtil.getAdjustedY(45)], null, backgroundImagePath, [TCUtil.getAdjustedX(320),TCUtil.getAdjustedY(380)]);
		this.addChild(this._backgroundImage);
		
		this.makeTouchSwallower();//DONT CHANGE ITS POSITIOIN
		
		
		this._mainMenuText = GLFactory.getText([TCUtil.getAdjustedX(110), TCUtil.getAdjustedY(30)], 100, Core.Localization.getString("MAIN_MENU"), [TCUtil.getAdjustedX(100), TCUtil.getAdjustedY(50)], TCUtil.getAdjustedFontSize(120), null, null, GL2.Text.OverflowMode.ReduceFontSize, [0.0, 0.5], new Core.Color(1,1,1));
		this._backgroundImage.addChild(this._mainMenuText);
		
		this._closeButton = new GLButton(closeButtonImageNormal, closeButtonImagePressed, TCUtil.getAdjustedX(40),TCUtil.getAdjustedY(40), this.onCloseTouch.bind(this), this._backgroundImage, 3, null, null, null, null, null);
		this._closeButton.setPosition(TCUtil.getAdjustedX(280), TCUtil.getAdjustedY(25));
		this._closeButton.setDisabledImagePath(closeButtonImagePressed);
		
		///
		var shopButtonImageNormal = this.getButtonImagePath()+"store-button-normal.png";
		var shopButtonImagePressed = this.getButtonImagePath()+"store-button-pressed.png";
		this._shopButton = new GLButton(shopButtonImageNormal, shopButtonImagePressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.onShopButtonTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("STORES"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._shopButton.setPosition(TCUtil.getAdjustedX(163),TCUtil.getAdjustedY(85));
		this._shopButton.setDisabledImagePath(shopButtonImagePressed);
		this._menuButtonsArray.addObject(this._shopButton);
		this._shopButton.setButtonTextBelowButton();
		
		var decoButtonImageNormal = this.getButtonImagePath()+"decoration-button-normal.png";
		var decoButtonImagePressed = this.getButtonImagePath()+"decoration-button-pressed.png";
		this._decorationButton = new GLButton(decoButtonImageNormal, decoButtonImagePressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.onDecorationButtonTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("DECORATIONS"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._decorationButton.setPosition(TCUtil.getAdjustedX(75),TCUtil.getAdjustedY(85));
		this._decorationButton.setDisabledImagePath(decoButtonImagePressed);
		this._menuButtonsArray.addObject(this._decorationButton);
		this._decorationButton.setButtonTextBelowButton();
		
		var liftButtonImageNormal = this.getButtonImagePath()+"add-elevator-normal.png";
		var liftButtonImagePressed = this.getButtonImagePath()+"add-elevator-pressed.png";		
		this._liftButton = new GLButton(liftButtonImageNormal, liftButtonImagePressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.onLiftButtonTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("ADD_ELEVATOR"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._liftButton.setPosition(TCUtil.getAdjustedX(250),TCUtil.getAdjustedY(85));		
		this._liftButton.setDisabledImagePath(liftButtonImagePressed);
		this._menuButtonsArray.addObject(this._liftButton);
		this._liftButton.setButtonTextBelowButton();
		
		///		
		var addFloorButtonImageNormal = this.getButtonImagePath()+"add-floor-normal.png";
		var addFloorButtonImagePressed = this.getButtonImagePath()+"add-floor-pressed.png";			
		this._addFloorButton = new GLButton(addFloorButtonImageNormal, addFloorButtonImagePressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.onAddFloorTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("ADD_FLOOR"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._addFloorButton.setPosition(TCUtil.getAdjustedX(250),TCUtil.getAdjustedY(165));
		this._addFloorButton.setDisabledImagePath(addFloorButtonImagePressed);
		this._menuButtonsArray.addObject(this._addFloorButton);
		this._addFloorButton.setButtonTextBelowButton();
								
		this._zoomButton = new GLButton(this._zoomButtonPath, this._zoomButtonPath, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.zoomButtonTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("ZOOM_FRIEND"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._zoomButton.setPosition(TCUtil.getAdjustedX(163),TCUtil.getAdjustedY(165));
		this._zoomButton.setDisabledImagePath(this._zoomButtonPath);
		this._menuButtonsArray.addObject(this._zoomButton);
		this._zoomButton.setButtonTextBelowButton();
		
		var rateButtonImageNormal = this.getButtonImagePath()+"rate-game-normal.png";
		var rateButtonImagePressed = this.getButtonImagePath()+"rate-game-pressed.png";
		this._rateGameButton = new GLButton(rateButtonImageNormal, rateButtonImagePressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.onRateGameTouch.bind(this), this._backgroundImage, 3,  Core.Localization.getString("RATE_GAME"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._rateGameButton.setPosition(TCUtil.getAdjustedX(75),TCUtil.getAdjustedY(165));		
		this._rateGameButton.setDisabledImagePath(rateButtonImagePressed);
		this._menuButtonsArray.addObject(this._rateGameButton);
		this._rateGameButton.setButtonTextBelowButton();
		
//		///
//		this._chicksRevegeButton = new GLButton(genericButtonImagePathNormal, genericButtonImagePathPressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.onChicksRevengeTouch.bind(this), this._backgroundImage, 3, "Chicks Revenge", new Core.Color(1,1,1) , null, null, TCUtil.getAdjustedFontSize(90));
//		this._chicksRevegeButton.setPosition(TCUtil.getAdjustedX(75),TCUtil.getAdjustedY(245));
//		this._chicksRevegeButton.setDisabledImagePath(genericButtonImagePathPressed);
//		this._menuButtonsArray.addObject(this._chicksRevegeButton);

		var giftButtonImageNormal = this.getButtonImagePath()+"gift-button-normal.png";
		var giftButtonImagePressed = this.getButtonImagePath()+"gift-button-pressed.png";			
		this._giftsButton = new GLButton(giftButtonImageNormal, giftButtonImagePressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.giftsButtonTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("GIFTS"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._giftsButton.setPosition(TCUtil.getAdjustedX(163),TCUtil.getAdjustedY(245));
		this._giftsButton.setDisabledImagePath(giftButtonImagePressed);
		this._menuButtonsArray.addObject(this._giftsButton);
		this._giftsButton.setButtonTextBelowButton();

		var settingsButtonImageNormal = this.getButtonImagePath()+"settings-button-normal.png";
		var settingsButtonImagePressed = this.getButtonImagePath()+"settings-button-pressed.png";				
		this._settingsButton = new GLButton(settingsButtonImageNormal, settingsButtonImagePressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.onSettingsTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("SETTINGS"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._settingsButton.setPosition(TCUtil.getAdjustedX(250),TCUtil.getAdjustedY(245));
		this._settingsButton.setDisabledImagePath(settingsButtonImagePressed);
		this._menuButtonsArray.addObject(this._settingsButton);
		this._settingsButton.setButtonTextBelowButton();
		//
		///
		var coinsButtonImageNormal = this.getButtonImagePath()+"coins-button-normal.png";
		var coinsButtonImagePressed = this.getButtonImagePath()+"coins-button-pressed.png";
		this._coinsButton = new GLButton(coinsButtonImageNormal, coinsButtonImagePressed, TCUtil.getAdjustedX(50) ,TCUtil.getAdjustedY(50), this.coinsButtonTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("COINS"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._coinsButton.setPosition(TCUtil.getAdjustedX(75),TCUtil.getAdjustedY(325)); 
		this._coinsButton.setDisabledImagePath(coinsButtonImagePressed);
		this._menuButtonsArray.addObject(this._coinsButton);
		this._coinsButton.setButtonTextBelowButton();
		
		var nuggetsButtonImageNormal = this.getButtonImagePath()+"nuggets-button-normal.png";
		var nuggetsButtonImagePressed = this.getButtonImagePath()+"nuggets-button-pressed.png";		
		this._nuggetsButton = new GLButton(nuggetsButtonImageNormal, nuggetsButtonImagePressed, TCUtil.getAdjustedX(50),TCUtil.getAdjustedY(50), this.nuggetsButtonTouch.bind(this), this._backgroundImage, 3, Core.Localization.getString("NUGGETS"), new Core.Color(1,1,1), null, null, TCUtil.getAdjustedFontSize(90));
		this._nuggetsButton.setPosition(TCUtil.getAdjustedX(75),TCUtil.getAdjustedY(245));
		this._nuggetsButton.setDisabledImagePath(nuggetsButtonImagePressed);
		this._menuButtonsArray.addObject(this._nuggetsButton);
		this._nuggetsButton.setButtonTextBelowButton();
	},
	
	getMenuButtonsArray: function()
	{
		if(this._menuButtonsArray)
		{
			return this._menuButtonsArray;
		}
		return null;
	},
	
	setButtonsEnable: function(bool)
	{
		if(this._closeButton)
		{
			this._closeButton.setIsEnabled(bool);
		}
		var menuButtonCount = this._menuButtonsArray.getLength();
		for(var i = 0; i < menuButtonCount; i++)
		{
			if(this._menuButtonsArray.objectAtIndex(i))
			{
				this._menuButtonsArray.objectAtIndex(i).setIsEnabled(bool);
			}
		}
	},
	
	onSettingsTouch: function()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
		var settingsWindow= new MMSettingsWindow();
		settingsWindow.createView();
		settingsWindow.setDepth(4);
		
		MMGameLayer.getControlLayer().addChild(settingsWindow);
		this.destroy();
	},
	
	onShopButtonTouch: function()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
		var storeId = '1';
		var categoryId = '1';
		var storeMainView =  new StoreMainView(storeId, categoryId);
		storeMainView.createView();
		NGWindow.document.addChild(storeMainView);
		
		if(!TutorialManager.getHasCompletedTutorial())
		{
			if(TutorialManager.getCurrentTutorialStep() == 10)
			{
				var bottomBar = MMGameLayer.getControlLayer().getBottomBar();
				var tutorialIndicator = bottomBar._tutorialIndicatorForMenu;
				if(tutorialIndicator)
				{
					tutorialIndicator.destroy();
					bottomBar._tutorialIndicatorForMenu = null;
					bottomBar.showTutorialIndicatorForMenu();
					tutorialIndicator = bottomBar._tutorialIndicatorForMenu;
					tutorialIndicator.setPosition([TCUtil.getAdjustedX(0), TCUtil.getAdjustedY(135)]);
				}
			}
		}
		
		this.destroy();
	},
	
	onDecorationButtonTouch: function()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
		var storeId = '2';
		var categoryId = '1';
		var storeMainView =  new StoreMainView(storeId, categoryId);
		storeMainView.createView();
		NGWindow.document.addChild(storeMainView);
		this.destroy();
	},
	
	onLiftButtonTouch: function()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
		this.destroy();		
		var elevatorID = "4_1_1";
		
		var totalElevators = ElevatorHandler.getElevatorsUIArray().getLength();
		var totalFloors = MMGameLayer.getMallUI().getFloorsUIArray().getLength();
		
		var elevatorLimit = totalFloors / FLOORS_PER_ELEVATOR;
		
		if(elevatorLimit > totalElevators)
		{
			ElevatorHandler.addElevator(elevatorID);
			AnalyticsHandler.logAnalyticsTransaction(elevatorID);
		}
		else
		{
			var requiredFloors = (totalElevators * FLOORS_PER_ELEVATOR) + 1;		
			var alertBox = UIFactory.getAlertBox(Core.Localization.getString("MESSAGE"), GALocalizationHandler.getRelativeString(Core.Localization.getString("LESS_FLOORS_TO_BUY_ELEVATOR"),[requiredFloors]), ["ok"], this); 
		}
		
		if(!TutorialManager.getHasCompletedTutorial())
		{
			if(TutorialManager.getCurrentTutorialStep() == 7)
			{
				var tutorialIndicator = MMGameLayer.getControlLayer().getBottomBar()._tutorialIndicatorForMenu;
				if(tutorialIndicator)
				{
					tutorialIndicator.destroy();
					MMGameLayer.getControlLayer().getBottomBar()._tutorialIndicatorForMenu = null;
				}
				TutorialManager.showNextTutorialStep();
			}
		}
	},

	zoomButtonTouch: function()
	{	
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);	
		var scale = MMGameLayer.getMallContainer().getScale();
		var zoomInButtonPath = this.getBaseResourcePath() + "zoom-in.png";
		var zoomOutButtonPath = this.getBaseResourcePath() + "zoom-out.png";
		if(scale.getX() == 1)
		{
			this._zoomButton._path1 = zoomInButtonPath;
			this._zoomButton._path2 = zoomOutButtonPath;			
			this._zoomButton.getButton().setImage(zoomInButtonPath,[TCUtil.getAdjustedX(100),TCUtil.getAdjustedY(80)]);
			this.zoomOutView();
		}
		else 
		{
			this._zoomButton._path1 = zoomOutButtonPath;
			this._zoomButton._path2 = zoomInButtonPath;			
			this._zoomButton.getButton().setImage(zoomOutButtonPath,[TCUtil.getAdjustedX(100),TCUtil.getAdjustedY(80)]);
			this.zoomInView();
		}
	},
	
	zoomOutView: function()
	{
		if(TutorialManager.getHasCompletedTutorial())
		{
			MMGameLayer.getControlLayer().showSocialInteractionUI();
			MMGameLayer.getMallContainer().zoomOutView();
			this.destroy();
		}
		
		else
		{
			TutorialManager.getTutorialPopup().updateText(Core.Localization.getString("TUTORIAL_TEXT_12_B"));	
			var bottomBar = MMGameLayer.getControlLayer().getBottomBar(); 
			bottomBar.disbaleMainMenuButton();
			//bottomBar.showLeftTutorialIndicatorForMenu();
			bottomBar.hideTutorialIndicatorForMenu();
			MMGameLayer.getControlLayer().showSocialInteractionUI();
			MMGameLayer.getControlLayer().disableMobageUserFinder();
			MMGameLayer.getMallContainer().zoomOutView();
			this.destroy();
		}
	},
	
	zoomInView: function()
	{
		MMGameLayer.getControlLayer().removeSocialInteractionUI();
		MMGameLayer.getMallContainer().zoomInView();
		this.destroy();
	},
	
	onAddFloorTouch: function()
	{
		MMGameLayer.getMallUI().addFloor();
		
		if(!TutorialManager.getHasCompletedTutorial())
		{
			if(TutorialManager.getCurrentTutorialStep() == 6)
			{
				var tutorialIndicator = MMGameLayer.getControlLayer().getBottomBar()._tutorialIndicatorForMenu;
				if(tutorialIndicator)
				{
					tutorialIndicator.destroy();
					MMGameLayer.getControlLayer().getBottomBar()._tutorialIndicatorForMenu = null;
				}
			}
		}
		this.destroy();
	},
	
	checkZoomState: function()
	{
		var zoomInButtonPath = this.getBaseResourcePath() + "zoom-in.png";
		var zoomOutButtonPath = this.getBaseResourcePath() + "zoom-out.png";						
		var scale = MMGameLayer.getMallContainer().getScale();
		
		if(scale.getX() == 1)
		{
			this._zoomButtonPath = zoomOutButtonPath;
			return;
		}
		this._zoomButtonPath = zoomInButtonPath;
	},
	
	onChicksRevengeTouch: function()
	{
		//Social.Common.Service.openUserFinder();
		//Social.Common.Service.openFriendPicker(2,null);
	},
	
	giftsButtonTouch: function()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
		var receivedGiftMainView =  new ReceivedGiftMainView();
		receivedGiftMainView.createView();
		NGWindow.document.addChild(receivedGiftMainView);
		this.destroy(); 
	},
	
	coinsButtonTouch: function()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
		var storeId = '9';
		var categoryId = '2';
		var inAppMainView =  new InAppMainView(storeId, categoryId);
		inAppMainView.createView();
		NGWindow.document.addChild(inAppMainView);
		this.destroy();
//		console.log("Zulu: Persistance GET Request initiated");
//		PersistanceManager.getUser();
	},
	
	nuggetsButtonTouch: function()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
		var storeId = '9';
		var categoryId = '1';
		var inAppMainView =  new InAppMainView(storeId, categoryId);
		inAppMainView.createView();
		NGWindow.document.addChild(inAppMainView);
		this.destroy();
//		console.log("Zulu: Persistance REMOVE Request initiated");
//		PersistanceManager.removeUser();
	},
	
	makeTouchSwallower: function()
    {        
    	this._dissolveTouchesTarget = new GL2.TouchTarget();
    	this._dissolveTouchesTarget.setAnchor(0,0);
		//this._dissolveTouchesTarget.setSize(TCUtil.getAdjustedX(width),TCUtil.getAdjustedY(height));
		this._dissolveTouchesTarget.setSize( [TCUtil.getAdjustedX(320),TCUtil.getAdjustedY(380)]);
        this._dissolveTouchesTarget.setPosition(TCUtil.getAdjustedY(0),TCUtil.getAdjustedX(0));
     
        this._myMessageListener = new Core.MessageListener();
		this._dissolveTouchesTarget.getTouchEmitter().addListener(this._myMessageListener, this.dissolveTouches.bind(this),10); //@ make this 10 go to Constants.
		this._backgroundImage.addChild(this._dissolveTouchesTarget);
    },
    
    dissolveTouches: function()
    {
    	return true;
    },
	
	onCloseTouch: function ()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
		this.destroy();
	},
	
	onRateGameTouch: function()
	{
		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
//		var AvatarSprite 	= 		require('../../NGGo/Service/Graphics/AvatarSprite').AvatarSprite;
 	//	this._myAvatarSprite = new AvatarSprite(null, null);
 	//	console.log("zaki::::: GAConfigurations.getRecordID()"+GAConfigurations.getRecordID());
        //MMGameLayer.getControlLayer().addChild(this._myAvatarSprite);
        //this._myAvatarSprite.setAvatarImage(GAConfigurations.getRecordID(), [35, 38], [0.48, 0.54]);
		//this.destroy();
	},
	
	getBaseResourcePath: function()
	{
		return "./Content/images/gamelayer/controllayer/";
	},
	
	getButtonImagePath: function()
	{
		return "./Content/images/gamelayer/controllayer/menubuttons/";
	},
	
	destroy: function ()
	{	
		if(this._backgroundImage)
		{
			this._backgroundImage.destroy();
			this._backgroundImage = null;
		}
		if(this._closeButton)
		{
			this._closeButton.destroy();
			this._closeButton = null;
		}
		if(this._shopButton)
		{
			this._shopButton.destroy();
			this._shopButton = null;
		}
		if(this._decorationButton)
		{
			this._decorationButton.destroy();
			this._decorationButton = null;
		}
		if(this._liftButton)
		{
			this._liftButton.destroy();
			this._liftButton = null;
		}				
		if(this._addFloorButton)
		{
			this._addFloorButton.destroy();
			this._addFloorButton = null;
		}		
		if(this._rateGameButton)
		{
			this._rateGameButton.destroy();
			this._rateGameButton = null;
		}
		if(this._chicksRevegeButton)
		{
			this._chicksRevegeButton.destroy();
			this._chicksRevegeButton = null;
		}
		if(this._settingsButton)
		{
			this._settingsButton.destroy();
			this._settingsButton = null;
		}				
		if(this._mainMenuText)
		{
			this._mainMenuText.destroy();
			this._mainMenuText = null;
		}
		if(this._zoomButton)
		{
			this._zoomButton.destroy();
			this._zoomButton = null;
		}
		if(this._dissolveTouchesTarget)
		{
			this._dissolveTouchesTarget.destroy();
			this._dissolveTouchesTarget = null;
		}
		if(this._myMessageListener)
		{
			this._myMessageListener.destroy();
			this._myMessageListener = null;
		}
		if(this._tasksButton)
		{
			this._tasksButton.destroy();
			this._tasksButton = null;
		}
		if(this._coinsButton)
		{
			this._coinsButton.destroy();
			this._coinsButton = null;
		}
		if(this._nuggetsButton)
		{
			this._nuggetsButton.destroy();
			this._nuggetsButton = null;
		}
		MMGameLayer.getControlLayer().getBottomBar()._mainMenu = null;
//		if(this._storeMenu)
//		{
//			this._storeMenu.destroy();
//			this._storeMenu = null;
//		}
	}
});